/**
 * 存储sessionStorage
 */
export const setStore = (name, content) => {
    if (!name) return
    if (typeof content !== 'string') {
      content = JSON.stringify(content)
    }
    window.sessionStorage.setItem(name, content)
  }
  
  /**
   * 获取sessionStorage
   */
  export const getStore = name => {
    if (!name) return
    return window.sessionStorage.getItem(name)
  }
  
  /**
   * 删除sessionStorage
   */
  export const removeStore = name => {
    if (!name) return
    window.sessionStorage.removeItem(name)
  }
  
  /**
   * 获取url参数
   */
  export const getUrlParams = () => {
    var qs = location.search.substr(1) // 获取url中"?"符后的字串
    var args = {} // 保存参数数据的对象
    var items = qs.length ? qs.split('&') : [] // 取得每一个参数项,
    var item = null
    var len = items.length
  
    for (var i = 0; i < len; i++) {
      item = items[i].split('=')
      var name = decodeURIComponent(item[0])
      var value = decodeURIComponent(item[1])
      if (name) {
        args[name] = value
      }
    }
    return args
  }
  
  /**
   * 判断空值
   */
  export const isEmpty = function(val){
    if (typeof val === 'undefined' || val === null || val.toString().trim() === '') {
      return true
    }
    return false
  }
  